/*
 * Copyright 2010-2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.pathlet.core;

import org.pathlet.core.config.ResourceConfig;
import org.pathlet.core.exception.ResourceException;

/**
 * 可根据路径来创建资源的工厂接口。
 * @param <T>
 */
public interface ConfigResourceFactory<T extends PathletResource> extends ResourceFactory {

	/**
	 * In generally the resources will be generated by ResourceFactory internal
	 * implementation. But in some customized requirement, some specific
	 * Resource could be added manually. This method provide a interface to add
	 * resource manually.
	 *
	 * @param resourceConfig
	 * @return the previous value associated with <tt>resource.path</tt>, or
	 *         <tt>null</tt> if there was no mapping for <tt>resource.path</tt>.
	 * @throws ResourceException
	 */
	T createResource(ResourceConfig resourceConfig)
			throws ResourceException;

}
